using GameCore;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ButtleItem : MonoBehaviour
{
    public AudioClip clip;

    private void Awake()
    {
        EventManager.Instance.Register<bool>(EventName.GameOverEvent, GameOver);
    }

    private void OnDestroy()
    {
        EventManager.Instance.Unregister<bool>(EventName.GameOverEvent, GameOver);
    }

    private void GameOver(bool obj)
    {
        gameObject.SetActive(false);
    }


    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Enemy"))
        {
            collision.gameObject.GetComponent<Enemy>().IsEnemyDie.EnemyDie();
            Debug.Log("ButtleItem");
            AssetsManager.Instance.FreeObject(gameObject);
            //Destroy(gameObject);
        }
    }
}
